<template>
  <iframe :style="styleColor" :src="styleColor.iframeAdress" width="100%" height="100%"/>
</template>

<script>
export default {
  name: "WidgetIframe",
  components: {},
  props: {
    value: Object
  },
  data() {
    return {
      options: {}
    };
  },
  computed: {
    transStyle() {
      let options = Object.assign({}, this.options.setup)
      options = Object.assign(options, this.options.position)
      return options;
    },
    styleColor() {
      return {
        width: this.transStyle.width + "px",
        height: this.transStyle.height + "px",
        zIndex: this.transStyle.zIndex,
        iframeAdress: this.transStyle.iframeAdress
      };
    }
  },
  watch: {
    value: {
      handler(val) {
        this.options = val;
      },
      deep: true
    }
  },
  mounted() {
    this.options = this.value;
  }
};
</script>

<style scoped lang="less">
iframe {
  width: 100%;
  height: 100%;
  border: none;
}
</style>
